<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            height: 100px;
            width: 100px;
            background-color: rgb(132, 0, 255);
        }
        
        body {
            background-color: rgb(255, 255, 255);
        }
    </style>
</head>

<body>
    <div></div>
    <p id="hh"></p>
    <button onclick="wo()">点我看看</button>
</body>

</html>
<script>
    var yue;
    // yue={ a:1,b:2,c:3,d:4,e:5

    // }
    yue = 2;
    if (yue == 1 || yue == 3 || yue == 5 || yue == 7 || yue == 8 || yue == 10 || yue == 12) {
        console.log(31 + "天")
    } else if (yue == 2) {
        console.log(29 + '天')
    } else {
        console.log(30 + "天")
    };


    // 闰年的条件是,年份对4整除但是不能对100整除,获取能对400整除!!
    var nian;
    nian = 2002;
    if (nian % 4 == 0 && nian % 100 != 0 || 400 % nian == 0) {
        console.log(nian + "是闰年")

    } else {
        console.log(nian + "是平年")
    };
    // 3.获取三个数中的最大数.
    var a = 10,
        b = 50,
        c = 40;
    if (a > b && a > c) {
        console.log(a)
    } else
    if (b > a && b > c) {
        console.log(b)

    } else {
        console.log(c)
    }

    // 4.定义点击事件,点击标签修改body的颜色!!!(上课讲的效果!)
    var div = document.getElementsByTagName('div')[0];
    var body = document.getElementsByTagName('body')[0];
    console.log(div);
    console.log(body);
    var a = 10,
        b = 20,
        c = 10;
    div.onclick = function() {
        a += 10;
        b += 19;
        c += 30;
        body.style.backgroundColor = "rgb(" + a + "," + b + "," + c + ")";
        if (a >= 255) {
            a = 10
        };
        if (b >= 255) {
            b = 19
        };
        if (c >= 255) {
            c = 30
        };
    }


    // 5.参考 “文本写入和读取.html” 练习如何给标签写数据以及读取标签的数据!
    var p = document.getElementById("hh");
    var dian = document.getElementsByTagName("buttom")[0];
    console.log(dian);

    function wo() {
        p.innerHTML = '你还真点啊'
    }

    // 6.定义输入框,用于获取自己的生日,判断自己的星座!!!
</script>